#ifndef _HELIX_MODEL_H_
#define _HELIX_MODEL_H_


#include <stdlib.h>
#include "HObject.h"
#include "HTriMesh.h"
#include "HPhysObject.h"




class HModel : public HObject
{
protected:
	//link to a physics object
	HPhysObject *PhysData;        

	//the actual vertex data 
	HTriMesh *TMesh;   

	//material and texture object
//	HMatShader *Shader;

public:
	HModel();
	~HModel();

	bool SetPhysData(HPhysObject *pdata);
	bool SetMeshData(HTriMesh *tmesh);
    HPhysObject *GetPhysData();
	HTriMesh *GetMeshData();


	bool LoadModelMesh(char *fileName);
	bool LoadModel(char *fileName);
	bool SaveModel(char *fileName);

	void  SetPosition(float x,float y,float z);
	float *GetPosition();
	float *GetPositionAndOrientation();

	void  SetVelocity(float x,float y,float z);    //sets the velocity of an object
	void  SetRestitution(float restitution);       //set the restitution value of an object

    void  ApplyImpulse(float wx,float wy,float wz,
		               float ix,float iy,float iz); //apply an impulse to an object at a point in world space

};

HModel::HModel()
{
	PhysData=NULL;
	TMesh=NULL;
}

HModel::~HModel()
{

}

bool HModel::SetPhysData(HPhysObject *pdata)
{
	PhysData=pdata;
	return pdata!=NULL;
}

bool HModel::SetMeshData(HTriMesh *tmesh)
{
	TMesh=tmesh;
	return tmesh!=NULL;
}

HPhysObject *HModel::GetPhysData()
{
	return PhysData;
}

HTriMesh *HModel::GetMeshData()
{
	return TMesh;
}

bool LoadModelMesh(char *fileName)
{
	return false;
}

bool LoadModel(char *fileName)
{
	return false;
}

bool SaveModel(char *fileName)
{
	return false;
}



void HModel::SetPosition(float x,float y,float z)
{
	PhysData->SetPosition(x,y,z);
}	

float *HModel::GetPosition()
{
	return PhysData->GetPosition();
}

float *HModel::GetPositionAndOrientation()
{
	return PhysData->GetPositionAndOrientation();
}

void  HModel::SetVelocity(float x,float y,float z)    //sets the velocity of an object
{
	PhysData->SetVelocity(x,y,z);
}
void  HModel::SetRestitution(float restitution)       //set the restitution value of an object
{
	PhysData->SetRestitution(restitution);
}

void  HModel::ApplyImpulse(float wx,float wy,float wz,float ix,float iy,float iz) //apply an impulse to an object at a point in world space
{
	PhysData->ApplyImpulse(wx,wy,wz,ix,iy,iz);
}

#endif